from pyecharts import options as opts
from pyecharts.charts import Scatter
import pandas as pd

data = pd.read_csv('../data/lianjia_data.csv')
# print(data['total_price'])  #总价
# print(data.hourseSize) #面积

scatter = (
    Scatter()
    .add_xaxis(data.hourseSize)
    .add_yaxis("链家散点图", data.total_price)
    .set_global_opts(
        visualmap_opts=opts.VisualMapOpts(
            is_show=True,
            min_=20,
            max_=3000
        ),
        xaxis_opts=opts.AxisOpts(
            name='面积/平米',type_='value'
        ),
        yaxis_opts=opts.AxisOpts(
            name='总价/万元',type_='value'
        )
    )
    .set_series_opts(
        label_opts=opts.LabelOpts(
            is_show=False
        ),
        markpoint_opts=opts.MarkPointOpts(
            data=[
                opts.MarkPointItem(
                    name='最低价',
                    type_='min'
                ),
                opts.MarkPointItem(
                    name='最高价',
                    type_='max'
                )
            ]
        )
    )



    .render()
)